#include "PCA9685.h"
#include "PCA_USART.h"
#include "OLED.H"
#include "TIMER_0.H"





u8 move_config; //机械臂状态标志

int main()
{

    
    EA = 1;
    PCA9685_Init(); //PCA9685初始化
    USART1_Init(); //串口初始化
    PCA_Init();
    
    Timer_0_Servo_Com(SPEED_3);

    while(1)
    
    { 
	
       
        switch (USART1_Read())//对串口数据进行接受
        {
        case 'q':
            move_config = JI_XIE_BI_INIT;   
            TIMER_0_ON;     //定时器0打开
        break;
        case 'e':
            move_config = STAT;   
            TIMER_0_ON;     //定时器0打开
        break;
        case 'w':
            move_config = FOW_CONFIG; 
            TIMER_0_ON; //定时器0打开
     
        break;
        
        case 's':
            move_config = BACK_CONFIG; 
            TIMER_0_ON; //定时器0打开
        break;

        case 'a':
            move_config = LEFT_CONFIG; 
            TIMER_0_ON; //定时器0打开
        break;

        case 'd':
            move_config = RIGHT_CONFIG; 
            TIMER_0_ON; //定时器0打开
        break;
        TX1_write2buff(0x77);
        }
    }
}

